import {goodsDetailRequest} from '@api/index'
const state = {
    goodDetailList : {}
}
const mutations = {
    SET_GOODDETAIL_STATE (state,value){
        state.goodDetailList = value
    }
}
const actions = {
   async getGoodDetail({commit},skuId){
        const re = await goodsDetailRequest(skuId)
        // console.log(re,'rereresssss');
        commit('SET_GOODDETAIL_STATE',re)
    }
}
const getters = {
    categoryView(state){
        return state.goodDetailList.categoryView || {}
    },
    spuSaleAttrList(state){
        return state.goodDetailList.spuSaleAttrList || {}
    },
    skuInfo(state){
        return state.goodDetailList.skuInfo || {}
    },
}

export default  {
    namespaced:true,
    state,
    mutations,
    actions,
    getters
}